home *** CD-ROM | disk | FTP | other *** search
- Since you have this disk (and probably have it companion), I am assuming that
- you are interested in compiling PC (ST) HACK. Here is how I did it.
-
- SYSTEM REQUIREMENTS:
- First, you need a C compiler (I did this with Lattice C).
-
- You need at least the equivalent of two single sided disk drives. I used
- a 1 MByte 520 ST and single sided disk drive. For compiling, I used 512K
- of the memory for a RAM disk and loaded both compiler passes, the LC program
- that invokes the passes, the stdio.h, setjmp.h, and osbind.h into it. Then
- I added the headers.fld folder from the first source disk. If you are doing
- any modifications, you can also load an editor (I used the micro EMACS, about
- 30 KBytes). Then, I moved the .c source files from the disk to RAM disk, four
- at a time, edited and compiled them. The .bin files generated were copied
- onto an empty diskette. All the files alphabetically before u_init fit on
- one diskette. The command line to compile each file is:
- lc -n -iheaders.fld\ <name>
- All the rest of the .bin files, the .lnk file, and the .ttp resulting file
- fit on one more diskette. You don't need to compile all the .c files. The
- one called makedefs.c is used just for generating the data file for the game.
- Furthermore, some are others broken into pieces that the linker can handled.
- These are easily identified by the main name followed by a number (i.e. do.c
- was broken into do1.c and do2.c. Compile do1.c and do2.c, but not do.c).
-
- After compiling each file, I resized the RAM disk to 400K. Then, I copied
- the linker, clib.bin, startup.bin, the hack.lnk file, and all the .bin files
- from the second diskette onto the RAM disk. I put the first diskette into the
- drive and invoked the linker with the command line:
- linker -with hack -nolist -prog hack.ttp
- Six minutes later (if all goes well), the program is linked. Then it
- can be copied to the game diskette.
-
- PROBLEMS:
-
- Here is a list of problems I encountered in compiling this beast (pun intended).
-
- 1) max() is defined in a header file. It was used as the formal parameter
- to a function and the compiler wouldn't take it. Solution: change the name
- of the formal parameter.
-
- 2) one function declared 7 parameters, all register variables. The second
- pass of the compiler choked on this. Solution: remove the register specifier.
-
- 3) the compiler converted all symbols passed to the linker to upper case letters
- (so xmonname and Xmonname were both seen by the linker as XMONNAME). Solution:
- change the name of one function.
-
- 4) some files would not link. The linker gave a "relocation" error. In the
- process of breaking the files up to find where the problem is, I discovered
- that each piece would link separately. What is ironic is that some of the
- largest files linked with no problem and some of the smallest failed!
- Solution: break up the unlinkable files and try again.
-
- 5) some messages were incomplete. The strncpy library routine ALWAYS places
- a null at the end of the string. The standard UNIX(r) routines place a null
- at the end only if one is found in the source string before the specified
- number of bytes are copied. Solution: write a strncpy routine.
-
- 6) address bombs when reading and writing game files to or from the RAM disk.
- This one appears to be a problem in TOS that sometimes shows up when a large
- (more than sector number) of bytes are written after an odd number of bytes.
- Solution: be sure an even number of bytes are written in each write call.
-
- 7) bus error bombs when generating and reading back "bones" files. This one
- was traced to some bad code generated by the compiler. Here is the variable
- declaration:
-
- struct permonst mons[]={...
- }
- struct permonst pm_ghost={...};
-
- Later, a pointer was set to pm_ghost and &mons[0] was subtracted from it.
- When the result should have been 0x39, it came out as 0x60039. The linker
- map showed that pm_ghost was 0x39 * sizeof(permonst) bytes away from mons[0].
- Solution: fold pm_ghost and similar structures into the mons array of
- structures.
-
- 8) "record" file (containing the scores from previous games) gets garbage.
- This has been traced to the fscanf library routine (thus, the program appears
- to write the scores fine, but sometimes can't read what it wrote). Solution:
- I haven't found one yet.
-